<!doctype html>
<html class="no-js" lang="en" xmlns:th="http://www.thymeleaf.org">

    <head>
        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title>修改员工信息</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <!-- favicon
            ============================================ -->
        <link rel="shortcut icon" type="image/x-icon" th:href="@{/img/favicon.ico}">
        <!-- Google Fonts
            ============================================ -->
        <link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,700,900" rel="stylesheet">
        <!-- Bootstrap CSS
            ============================================ -->
        <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}">
        <!-- Bootstrap CSS
            ============================================ -->
        <link rel="stylesheet" th:href="@{/css/font-awesome.min.css}">
        <!-- owl.carousel CSS
            ============================================ -->
        <link rel="stylesheet" th:href="@{/css/owl.carousel.css}">
        <link rel="stylesheet" th:href="@{/css/owl.theme.css}">
        <link rel="stylesheet" th:href="@{/css/owl.transitions.css}">
        <!-- animate CSS
            ============================================ -->
        <link rel="stylesheet" th:href="@{/css/animate.css}">
        <!-- normalize CSS
            ============================================ -->
        <link rel="stylesheet" th:href="@{/css/normalize.css}">
        <!-- meanmenu icon CSS
            ============================================ -->
        <link rel="stylesheet" th:href="@{/css/meanmenu.min.css}">
        <!-- main CSS
            ============================================ -->
        <link rel="stylesheet" th:href="@{/css/main.css}">
        <!-- forms CSS
            ============================================ -->
        <link rel="stylesheet" th:href="@{/css/form/all-type-forms.css}">
        <!-- educate icon CSS
            ============================================ -->
        <link rel="stylesheet" th:href="@{/css/educate-custon-icon.css}">
        <!-- morrisjs CSS
            ============================================ -->
        <link rel="stylesheet" th:href="@{/css/morrisjs/morris.css}">
        <!-- dropzone CSS
            ============================================ -->
        <link rel="stylesheet" th:href="@{/css/dropzone/dropzone.css}">
        <!-- mCustomScrollbar CSS
            ============================================ -->
        <link rel="stylesheet" th:href="@{/css/scrollbar/jquery.mCustomScrollbar.min.css}">
        <!-- metisMenu CSS
            ============================================ -->
        <link rel="stylesheet" th:href="@{/css/metisMenu/metisMenu.min.css}">
        <link rel="stylesheet" th:href="@{/css/metisMenu/metisMenu-vertical.css}">
        <!-- calendar CSS
            ============================================ -->
        <link rel="stylesheet" th:href="@{/css/calendar/fullcalendar.min.css}">
        <link rel="stylesheet" th:href="@{/css/calendar/fullcalendar.print.min.css}">
        <!-- style CSS
            ============================================ -->
        <link rel="stylesheet" th:href="@{/css/style.css}">
        <!-- responsive CSS
            ============================================ -->
        <link rel="stylesheet" th:href="@{/css/responsive.css}">
        <style>
            .file {
                position: relative;
                display: inline-block;
                background: rgb(0, 109, 240);
                border-radius: 4px;
                padding: 4px 12px;
                overflow: hidden;
                color: white;
                text-decoration: none;
                text-indent: 0;
                line-height: 20px;
            }

            .file input {
                position: absolute;
                font-size: 100px;
                right: 0;
                top: 0;
                opacity: 0;
            }

            .file:hover {
                /*
                background: #AADFFD;
                border-color: #78C3F3;
    */
                color: white;
                /*            text-decoration: none;*/
            }
        </style>

        <!-- modernizr JS
            ============================================ -->
        <script th:src="@{/js/vendor/modernizr-2.8.3.min.js}"></script>
    </head>

    <body>
        <!--[if lt IE 8]>
        <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a
                href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
        <![endif]-->
        <!-- Start Left menu area -->
        <div th:insert="~{/sideBar::sideBar}"></div>
        <!-- End Left menu area -->
        <!-- Start Welcome area -->
        <div class="all-content-wrapper">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                        <div class="logo-pro">
                            <a href="index.html"><img class="main-logo" th:src="@{/img/logo/logo.png}" alt=""/></a>
                        </div>
                    </div>
                </div>
            </div>
            <!--        top-->
            <div th:insert="~{/top::topBar}"></div>
            <!-- Single pro tab review Start-->
            <div class="single-pro-review-area mt-t-30 mg-b-15">
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                            <div class="product-payment-inner-st">
                                <ul id="myTabedu1" class="tab-review-design">
                                    <li class="active"><a href="#description">基本信息</a></li>
                                </ul>
                                <div id="myTabContent" class="tab-content custom-product-edit">
                                    <div class="product-tab-list tab-pane fade active in" id="description">
                                        <div class="row">
                                            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                                                <div class="review-content-section">
                                                    <div id="dropzone1" class="pro-ad">
                                                        <form id="upload"
                                                              style="display: flex;flex-direction: row;flex-wrap: wrap;width: 100%">
                                                            <div style="display: flex;flex-direction: column;width: 50%;padding-right: 1%">
                                                                <div style="margin-top: 30px">
                                                                    <input name="name" type="text" class="form-control" th:value="${staff.getStaffName()}"
                                                                           placeholder="姓名">
                                                                </div>
                                                                <div style="margin-top: 10px">
                                                                    <input name="birth" type="text" class="form-control" th:value="${staff.getStaffBirth()}"
                                                                           placeholder="出生日期">
                                                                </div>
                                                                <div style="margin-top: 10px">
                                                                    <input name="staffId" type="number" disabled="disabled" th:value="${staff.getStaffId()}"
                                                                           class="form-control" placeholder="员工编号">
                                                                </div>
                                                                <div style="margin-top: 10px">
                                                                    <input name="address" type="text" th:value="${staff.getStaffAddress()}"
                                                                           class="form-control" placeholder="地址">
                                                                </div>
                                                            </div>
                                                            <div style="display: flex;flex-direction: column;width: 50%;padding-left: 1%">
                                                                <div style="margin-top: 30px">
                                                                    <select name="gender" class="form-control">
                                                                        <option value="none" th:selected="${staff.getStaffGender()}" disabled="">
                                                                            性别
                                                                        </option>
                                                                        <option value="0">男</option>
                                                                        <option value="1">女</option>
                                                                    </select>
                                                                </div>
                                                                <div style="margin-top: 10px">
                                                                    <input name="phoneNum" type="text" th:value="${staff.getStaffPhone()}"
                                                                           class="form-control" placeholder="手机号">
                                                                </div>
                                                                <div style="margin-top: 10px">
                                                                    <input name="weChat" type="text" th:value="${staff.getStaffWeChat()}"
                                                                           class="form-control" placeholder="微信">
                                                                </div>
                                                                <div style="margin-top: 10px">
                                                                    <input name="partment" type="text" th:value="${staff.getStaffPartment()}"
                                                                           class="form-control" placeholder="部门">
                                                                </div>
                                                            </div>
                                                            <div style="width: 100%;margin-top: 20px">
                                                                <a href="javascript:;" class="file">添加照片
                                                                    <input type="file" name="file" id="chooseImg">
                                                                </a><br>
                                                                <img id="cropedBigImg" th:src="${staff.getStaffPicture()}" value='custom' alt="lorem ipsum dolor sit" data-address='' style="width: 30%;margin-left: 35%;border-radius: 5px"/>
                                                            </div>
                                                            <div style="width: 100%;text-align: center;margin-top: 20px">
                                                                <button type="button" class="btn btn-primary waves-effect waves-light" style="width: 8%"
                                                                        onclick="submitFunction()">提 交
                                                                </button>
                                                            </div>

                                                        </form>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!--        footer-->
            <div th:insert="~{/footer::footer}"></div>
        </div>

        <!-- jquery
            ============================================ -->
        <script th:src="@{/js/vendor/jquery-1.12.4.min.js}"></script>
        <!-- bootstrap JS
            ============================================ -->
        <script th:src="@{/js/bootstrap.min.js}"></script>
        <!-- wow JS
            ============================================ -->
        <script th:src="@{/js/wow.min.js}"></script>
        <!-- price-slider JS
            ============================================ -->
        <script th:src="@{/js/jquery-price-slider.js}"></script>
        <!-- meanmenu JS
            ============================================ -->
        <script th:src="@{/js/jquery.meanmenu.js}"></script>
        <!-- owl.carousel JS
            ============================================ -->
        <script th:src="@{/js/owl.carousel.min.js}"></script>
        <!-- sticky JS
            ============================================ -->
        <script th:src="@{/js/jquery.sticky.js}"></script>
        <!-- scrollUp JS
            ============================================ -->
        <script th:src="@{/js/jquery.scrollUp.min.js}"></script>
        <!-- mCustomScrollbar JS
            ============================================ -->
        <script th:src="@{/js/scrollbar/jquery.mCustomScrollbar.concat.min.js}"></script>
        <script th:src="@{/js/scrollbar/mCustomScrollbar-active.js}"></script>
        <!-- metisMenu JS
            ============================================ -->
        <script th:src="@{/js/metisMenu/metisMenu.min.js}"></script>
        <script th:src="@{/js/metisMenu/metisMenu-active.js}"></script>
        <!-- morrisjs JS
            ============================================ -->
        <script th:src="@{/js/sparkline/jquery.sparkline.min.js}"></script>
        <script th:src="@{/js/sparkline/jquery.charts-sparkline.js}"></script>
        <!-- calendar JS
            ============================================ -->
        <script th:src="@{/js/calendar/moment.min.js}"></script>
        <script th:src="@{/js/calendar/fullcalendar.min.js}"></script>
        <script th:src="@{/js/calendar/fullcalendar-active.js}"></script>
        <!-- maskedinput JS
            ============================================ -->
        <script th:src="@{/js/jquery.maskedinput.min.js}"></script>
        <script th:src="@{/js/masking-active.js}"></script>
        <!-- datepicker JS
            ============================================ -->
        <!--    <script th:src="@{/js/datepicker/jquery-ui.min.js}"></script>-->
        <!--    <script th:src="@{/js/datepicker/datepicker-active.js}"></script>-->
        <!-- form validate JS
            ============================================ -->
        <!--    <script th:src="@{/js/form-validation/jquery.form.min.js}"></script>-->
        <!--    <script th:src="@{/js/form-validation/jquery.validate.min.js}"></script>-->
        <!--    <script th:src="@{/js/form-validation/form-active.js}"></script>-->
        <!-- 文件上传 JS
            ============================================ -->


        <script>
            function submitFunction() {
                //这里唯一需要注意的就是这个form-add的id
                var formData = new FormData($("#upload")[0]);
                formData.set("name", $(" input[ name='name' ]").val());
                formData.set("birth", $(" input[ name='birth' ]").val());
                formData.set("staffId", $(" input[ name='staffId' ]").val());
                formData.set("address", $(" input[ name='address' ]").val());
                formData.set("gender", $(" select[ name='gender' ]").val());
                formData.set("phoneNum", $(" input[ name='phoneNum' ]").val());
                formData.set("weChat", $(" input[ name='weChat' ]").val());
                formData.set("partment", $(" input[ name='partment' ]").val());
                console.log(formData.get("name"));
                console.log(formData.get("birth"));
                console.log(formData.get("staffId"));
                console.log(formData.get("address"));
                console.log(formData.get("gender"));
                console.log(formData.get("phoneNum"));
                console.log(formData.get("weChat"));
                console.log(formData.get("partment"));
                $.ajax({
                    //接口地址
                    url: '/updatestaff',
                    type: 'POST',
                    data: formData,
                    async: false,
                    cache: false,
                    contentType: false,
                    processData: false,
                    success: function (data) {
                        console.log(data)
                        //成功的回调
                        if (data.code === 300) {
                            console.log(data)
                        }

                    },
                    error: function (returndata) {
                        //请求异常的回调window.event.returnValue = false;
                        // modals.warn("网络访问失败，请稍后重试!");
                    }
                });
            }
            $('#chooseImg').on('change', function() {
                var filePath = $(this).val(), //获取到input的value，里面是文件的路径
                    fileFormat = filePath.substring(filePath.lastIndexOf(".")).toLowerCase(),
                    src = window.URL.createObjectURL(this.files[0]); //转成可以在本地预览的格式

                // 检查是否是图片
                if (!fileFormat.match(/.png|.jpg|.jpeg/)) {
                    error_prompt_alert('上传错误,文件格式必须为：png/jpg/jpeg');
                    return;
                }

                $('#cropedBigImg').attr('src', src);
            });
        </script>
        <!-- tab JS
            ============================================ -->
        <script th:src="@{/js/tab.js}"></script>
        <!-- plugins JS
            ============================================ -->
        <script th:src="@{/js/plugins.js}"></script>
        <!-- main JS
            ============================================ -->
        <script th:src="@{/js/main.js}"></script>
        <script th:src="@{/js/myjs/reload.js}"></script>

        <!-- tawk chat JS
            ============================================ -->
        <!--    <script th:src="@{/js/tawk-chat.js}"></script>-->
    </body>

</html>
